package com.wang.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer;
import org.springframework.web.servlet.config.annotation.PathMatchConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

/**
 * @Classname DefaultMvcConfig
 * @Description TODO
 * @Date 2024/5/17 11:15
 * @Created by pc
 */
// @Configuration
public class DefaultMvcConfig extends WebMvcConfigurationSupport {

    @Override
    protected void configurePathMatch(PathMatchConfigurer configurer) {
        // 启用后缀匹配模式

        configurer.setUseRegisteredSuffixPatternMatch(true)
                //  /user    -- > /user/  也可以访问
                .setUseTrailingSlashMatch(true);
    }

    @Override
    protected void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
        configurer.favorPathExtension(true);
    }
}
